package com.czy.owner.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.czy.owner.R;
import com.czy.owner.entity.SpecialModel;
import com.czy.owner.entity.UserLocationModel;
import com.czy.owner.utils.glide.GlideUtils;
import com.easyrecycleview.adapter.BaseViewHolder;
import com.easyrecycleview.adapter.RecyclerArrayAdapter;


/**
 * Created by wangyang on 2017/5/18 0018.
 */

public class SpecialAreaAdapter extends RecyclerArrayAdapter<SpecialModel> {
    private Context context;

    public SpecialAreaAdapter(Context context) {
        super(context);
        this.context = context;
    }



    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new SpecialAreaViewHolder(parent);
    }

    class SpecialAreaViewHolder extends BaseViewHolder<SpecialModel> {

        private TextView item_tv_special_area;
        private ImageView item_iv_special_area;


        public SpecialAreaViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_special_area);
            item_tv_special_area = $(R.id.item_tv_special_area);
            item_iv_special_area = $(R.id.item_iv_special_area);
        }

        @Override
        protected int getDataPosition() {
            return super.getDataPosition();
        }

        @Override
        public void setData(final SpecialModel data) {
            super.setData(data);
            item_tv_special_area.setText(""+data.getSpecialModelName());

            GlideUtils.loadImage(getContext(),data.getLogo(), item_iv_special_area, new GlideUtils.ImageLoadListener<String, GlideDrawable>() {
                @Override
                public void onLoadingComplete(String uri, ImageView view, GlideDrawable resource) {

                }

                @Override
                public void onLoadingError(String source, Exception e) {

                }
            }, R.mipmap.bg_wheel_special, R.mipmap.bg_wheel_special);
        }
    }

}
